<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<script src="https://cdn.bootcss.com/jquery/3.4.1/jquery.min.js"></script>
		
		<script type="text/javascript">
			function  get_ajax(){
				$.ajax({
					type:"get",
					data: 'pid=1&pname=辣条',
					url:"http://localhost:8090/spring_restful/queryall",
					dataType: "json",
				    success:function(data){
				    	console.log(data);
				    }
				});
			}
			function  post_ajax(){
				$.ajax({
					type:"post",
					contentType:'application/json',
					data:  JSON.stringify({pid: 1,pname:'jenny',price:'10'}),
					url:"http://localhost:8090/spring_restful/add_product",
					dataType: "json",
				    success:function(data){
				    	console.log(data);
				    }
				});
			}
			
			function  put_ajax(){
				$.ajax({
					type:"put",
					contentType:'application/json',
					data:  JSON.stringify({pid: 1,pname:'jenny',price:'10'}),
					url:"http://localhost:8090/spring_restful/modify_product",
					dataType: "json",
				    success:function(data){
				    	console.log(data);
				    }
				});
			}
		</script>
	</head>
	<body>
		<div>
			数据
		</div>
		<button onclick="get_ajax()">get请求</button>
		<button onclick="post_ajax()">post请求</button>
		<button onclick="put_ajax()">put请求</button>
	</body>
</html>
